/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hoja.de.trabajo.pkg6;

/**
 *
 * @author Pedro
 */
public class node1 {
    int frequency; // frequency of char
    char ch; // the character
    public node1(int f)
    // post: construct an entry with frequency f
    {
        frequency=f;
    }
    public node1(char c)
    // post: construct character entry with frequency 1
    {
        ch=c;
        frequency=1;
    }
    public boolean equals(Object other)
// post: return true if leaves represent same character
    {
        if(other.equals(getCh()))
            return true;
        else 
            return false;
    }

    /**
     * @return the frequency
     */
    public int getFrequency() {
        return frequency;
    }

    /**
     * @param frequency the frequency to set
     */
    public void setFrequency(int frequency) {
        this.frequency = frequency;
    }

    /**
     * @return the ch
     */
    public char getCh() {
        return ch;
    }

    /**
     * @param ch caracter a decodificar
     */
    public void setCh(char ch) {
        this.ch = ch;
    }
    
    
    public String toSting()
    {   String result;
        result= "Caracter: "+ch;
        result+= "  Frecuencia: "+frequency;
    return result;}       
            }
